//全局loading；
const url= 'http://m.images.ourjb.com/ali-loading.gif';
function loading () {
  //显示loading时禁止滚动；
  document.body.addEventListener('touchmove',bodyScroll,false);
  document.body.style.position='fixed'
  document.body.style.width='100%'
  let loadWrap = document.createElement('div')
  let div = document.createElement('div')
  let img = document.createElement('img')
  div.setAttribute('class', 'loading')
  img.setAttribute('class', 'img')
  img.src =url
  div.appendChild(img)
  loadWrap.appendChild(div)
  document.body.appendChild(loadWrap)

  setTimeout(()=>{
    document.body.removeChild(loadWrap);
    document.body.removeEventListener('touchmove',bodyScroll,false);
    document.body.style.position='initial'
  },2000)
}

function bodyScroll(e){
  e.preventDefault();
}
export default loading
